﻿using DotNet.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XNWebModel;
using XNWebService;

namespace XNWebAPI.Controllers
{
    public class CustomerController : JsonController
    {
        private readonly CustomerServices service = new CustomerServices();

        /// <summary>
        /// 添加投诉建议
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult AddCustomer(CustomerService model)
        {
            return Json(service.AddCustomer(model));
        }


        /// <summary>
        /// 查询投诉建议
        /// </summary>
        /// <param name="Account">联系电话帐号</param>
        /// <returns></returns>
        [HttpGet]
        public ActionResult GetCustomer(string Account)
        {
            return Json(service.GetCustomerService(Account));
        }


        /// <summary>
        /// 新增客户服务[2寻物启事，3失物招领]
        /// </summary>
        /// <param name="entity">客户服务实体</param>
        /// <returns>执行成功返回BoolMessage.True</returns>
        [HttpPost]
        public ActionResult AddLookGetBack(CustomerService model)
        {
            return Json(service.AddLookGetBack(model));
        }

        /// <summary>
        /// 查询寻物招领分页
        /// </summary>
        /// <param name="eachPage">每页数量</param>
        /// <param name="pageNum">页码</param>
        /// <param name="serviceCategoryId">分类主键【2寻物启事，3失物招领】</param>
        /// <returns>serviceCategoryId为null或空时,返回全部2寻物启事，3失物招领数据</returns>
        [HttpGet]
        public ActionResult GetLookGetBack(int eachPage = 10, int pageNum = 1, int? serviceCategoryId = null)
        {
            return Json(service.GetLookGetBack(eachPage, pageNum, serviceCategoryId));
        }

    }

}